﻿/**
 * Peter
 * Created by: Peter Development Team
 *    http://peter.codeplex.com/
 * 
 * GNU General Public License version 2 (GPLv2)
 *    http://peter.codeplex.com/license
 *
 *  This code is provided on an AS IS basis, with no WARRANTIES,
 *  CONDITIONS or GUARANTEES of any kind.
 *
 **/

using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Windows.Input;
using Peter.Common;
using Peter.Common.Dialog;
using Peter.Common.Interfaces;

namespace Peter.Ruby.Tests
{
   public class MockPeter : IPeter
   {
      /// <summary>
      /// Event that occurs when the application is shutting down.
      /// </summary>
      public event EventHandler ShuttingDown;

      /// <summary>
      /// Event that occurs when the active content in Peter has changed.
      /// </summary>
      public event EventHandler ActiveContentChanged;

      /// <summary>
      /// Triggers the shutting down event.
      /// </summary>
      public void TriggerShuttingDown ()
      {
         if (this.ShuttingDown != null)
            this.ShuttingDown (this, EventArgs.Empty);
      }

      /// <summary>
      /// Triggers the active content changed event.
      /// </summary>
      public void TriggerActiveContentChanged ()
      {
         if (this.ActiveContentChanged != null)
            this.ActiveContentChanged (this, EventArgs.Empty);
      }

      /// <summary>
      /// Export for peter.
      /// </summary>
      [Export (typeof (IPeter))]
      public IPeter Peter
      {
         get { return this; }
      }

      /// <summary>
      /// Gets the version of Peter being used.
      /// </summary>
      public Version Version { get; set; }

      /// <summary>
      /// Gets the active content.
      /// </summary>
      public object ActiveContent { get; set; }

      /// <summary>
      /// Gets the active document object, null if object is not a document.
      /// </summary>
      public IDocument ActiveDocument { get; set; }

      /// <summary>
      /// Gets an enumeration of all the currently open content in Peter.
      /// </summary>
      /// <returns>All open content in Peter.</returns>
      public IEnumerable<IDockItem> GetAllOpenContent ()
      {
         yield break;
      }

      /// <summary>
      /// Adds a new item to the current document group 
      /// </summary>
      /// <param name="documentModel">The model of the item to add.</param>
      public void AddDocument (IPeterDocument documentModel)
      {
      }

      /// <summary>
      /// Adds a tool window.
      /// </summary>
      /// <param name="toolWindowModel">The model of the item to add.</param>
      public void AddToolWindow (IPeterToolWindow toolWindowModel)
      {
         this.LastToolWindow = toolWindowModel;
      }

      /// <summary>
      /// Creates a new file.
      /// </summary>
      public void NewFile ()
      {
      }

      /// <summary>
      /// Opens the given file.
      /// </summary>
      /// <param name="filePath">The full path to the file to open.</param>
      public void OpenFile (string filePath)
      {
         this.LastFileOpenRequest = filePath;
      }

      /// <summary>
      /// Opens the given files.
      /// </summary>
      /// <param name="filePaths">A list of full file paths to open.</param>
      public void OpenFile (IEnumerable<string> filePaths)
      {
      }

      /// <summary>
      /// Updates the title of the application.
      /// </summary>
      public void UpdateTitle ()
      {
      }

      /// <summary>
      /// Registers the given key binding with the application for hot key support.
      /// </summary>
      /// <param name="binding">The key binding to register.</param>
      public void RegisterHotkey (KeyBinding binding)
      {
      }

      /// <summary>
      /// Shows the options tab.
      /// </summary>
      /// <param name="startingOptionPage">The options page to start up.</param>
      public void ShowOptions (object startingOptionPage = null)
      {
         this.ShowOptionsCalled = true;
      }

      /// <summary>
      /// Closes the document with the given model.
      /// </summary>
      /// <param name="documentModel">Model to close.</param>
      public void CloseDocument (IPeterDocument documentModel)
      {
      }

      /// <summary>
      /// Closes the tool window with the given model.
      /// </summary>
      /// <param name="tooWindowModel">Model to close.</param>
      public void CloseToolWindow (IPeterToolWindow tooWindowModel)
      {
      }

      /// <summary>
      /// Shows the requested window.
      /// </summary>
      /// <param name="window">Window to show.</param>
      public void ShowToolWindow (PeterToolWindows window)
      {
      }

      /// <summary>
      /// Shows the given dialog.
      /// </summary>
      /// <param name="dialogContent">Dialog content to show.</param>
      public void ShowDialog (DialogBase dialogContent)
      {
      }

      /// <summary>
      /// Gets if the show options was called or not.
      /// </summary>
      public bool ShowOptionsCalled { get; private set; }

      /// <summary>
      /// Gets the path of the last file open request.
      /// </summary>
      public string LastFileOpenRequest { get; private set; }

      /// <summary>
      /// Gets the object that was added to the tool windows last.
      /// </summary>
      public IPeterToolWindow LastToolWindow { get; private set; }
   }
}
